﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

using PoolGame2.Physics;

namespace PoolGame2.Game
{
    class ObjectTrackingCamera : Camera
    {

        PhysicsObject trackingObject;
        Vector3 cameraUpVector;

        public ObjectTrackingCamera(PoolGame game, Vector3 position, Vector3 cameraTarget, Vector3 cameraUpVector, PhysicsObject pobj) : base( game )
        {
            this.DefaultProjection();
            this.cameraPosition = position;
            this.cameraTarget = cameraTarget;
            this.trackingObject = pobj;
            this.cameraUpVector = cameraUpVector;
            viewMatrix = Matrix.CreateLookAt(cameraPosition, trackingObject.getPosition(), cameraUpVector); 
        }

        public override void UpdateCamera(GameTime gametime)
        {
            viewMatrix = Matrix.CreateLookAt(cameraPosition, trackingObject.getPosition(), cameraUpVector); 
        }

    }
}
